﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Trakt
{
    public abstract class ClassEnumerationBase
    {
        public string Value { get; private set; }

        protected ClassEnumerationBase(string value)
        {
            Value = value;
        }

        public sealed override string ToString()
        {
            return Value;
        }

        /// <summary>Returns true if <paramref name="obj"/> is the same object, or equal to <see cref="Value"/></summary>
        /// <param name="obj">Object with which to compare</param>
        /// <returns>True if <paramref name="obj"/> is the same object, or equal to <see cref="Value"/></returns>
        public sealed override bool Equals(object obj)
        {
            if (object.ReferenceEquals(this, obj) || obj.Equals(Value))
                return true;

            return false;
        }

        public sealed override int GetHashCode()
        {
            return Value.GetHashCode();
        }
    }

    public sealed class ElementType : ClassEnumerationBase
    {
        private static ElementType _Movie = new ElementType("movie");
        private static ElementType _Show = new ElementType("show");
        private static ElementType _Episode = new ElementType("episode");
        private static ElementType _Person = new ElementType("person");
        private static ElementType _List = new ElementType("list");

        public static ElementType Movie { get { return _Movie; } }
        public static ElementType Show { get { return _Show; } }
        public static ElementType Episode { get { return _Episode; } }
        public static ElementType Person { get { return _Person; } }
        public static ElementType List { get { return _List; } }

        private ElementType(string value)
            : base(value) { }
    }
}
